import request from '@/utils/request';
// request.defaults.baseURL = 'https://console-mock.apipost.cn/app/mock/project/79ea3b05-05f2-4f42-b40d-3d7f56281f27'

/**
 * 店铺管理 店铺列表
 * @param data
 * @returns
 */
export const getStoreList = (data: any, flag = false) => {
    return request({
        url: '/scrm-api/console/retail/shop/list',
        method: 'GET',
        params: data,
        noNeedLoading: flag
    });
};
/**
 * 店铺管理 店铺详情
 * @param data
 * @returns
 */
export const getDetail = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/detail',
        method: 'GET',
        params: data
    });
};
/**
 * 店铺管理 店铺类型列表
 * @param data
 * @returns
 */
export const getStoreSourceList = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/source-list',
        method: 'GET',
        params: data
    });
};

/**
 * 店铺管理 新建店铺
 * @param data
 * @returns
 */
export const addStore = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/create',
        method: 'POST',
        data
    });
};

/**
 * 店铺管理 修改店铺状态 暂停/运行
 * @param data
 * @returns
 */
export const updateStoreState = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/change-state',
        method: 'POST',
        data
    });
};

/**
 * 店铺管理 编辑店铺
 * @param data
 * @returns
 */
export const editStore = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/edit',
        method: 'POST',
        data
    });
};

/**
 * 店铺管理 店铺 测试
 * @param data
 * @returns
 */
export const testStore = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/test-connective',
        method: 'GET',
        params: data
    });
};

/**
 * 店铺管理 删除店铺
 * @param data
 * @returns
 */
export const deleteStore = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/del',
        method: 'POST',
        data
    });
};

/**
 * 店铺详情 统计-数据总览
 * @param data
 * @returns
 */
export const getTotleData = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/statics-over-view',
        method: 'POST',
        data,
        timeout: 60000,
        noNeedLoading: true
    });
};

/**
 * 店铺详情 统计-趋势分析
 * @param data
 * @returns
 */
export const getTrendAnalysis = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/statics-trend-analysis',
        method: 'POST',
        data,
        noNeedLoading: true
    });
};

/**
 * 店铺详情 统计-转化
 * @param data
 * @returns
 */
export const getConverse = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/statics-converse',
        method: 'POST',
        data,
        timeout: 60000,
        noNeedLoading: true
    });
};

/**
 * 店铺详情 统计-交易、客户转化
 * @param data
 * @returns
 */
export const getTradingConverse = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/statics-converse-list',
        method: 'POST',
        data,
        noNeedLoading: true
    });
};

/**
 * 店铺详情 统计-加购、成功商品top
 * @param data
 * @returns
 */
export const getProductTop = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/statics-product-top',
        method: 'POST',
        data,
        noNeedLoading: true
    });
};

/**
 * 店铺详情 统计-销售额
 * @param data
 * @returns
 */
export const getSales = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/statics-sales',
        method: 'POST',
        data,
        noNeedLoading: true
    });
};

/**
 * 获取用户行为事件列表(公共接口)
 * @param data    //  1：店铺类型 2：订单来源 3：用户行为 4：支付方式 5：发送渠道 6：访问来源 7：浏览环境
 * @returns
 */
export const getDictEnum = (data: any) => {
    return request({
        url: '/scrm-api/console/common/dict_enum',
        method: 'GET',
        params: data
    });
};

/**
 * 获取客易达店铺信息
 * @param data
 * @returns
 */
export const getKYDInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/kyd-info',
        method: 'GET',
        params: data
    });
};

/**
 * 根据有赞id 判断是否授权
 * @param data
 * @returns
 */
export const getYouzanInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/yz-auth',
        method: 'POST',
        data
    });
};

/**
 * 订阅地址联通测试
 * @param data
 * @returns
 */
export const testUrl = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/test-con-url',
        method: 'GET',
        params: data
    });
};

/**
 * 淘宝店铺配置信息
 * @param data
 * @returns
 */
export const getTaoBaoInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/tb_shop_config',
        method: 'POST',
        data
    });
};

/**
 * 获取店铺详情信息
 * @param data
 * @returns
 */
export const getStoreDetail = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/shop-detail',
        method: 'GET',
        params: data
    });
};

/**
 * 店铺管理 新建店铺-客易达
 * @param data
 * @returns
 */
export const addKydStore = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/kyd-create',
        method: 'POST',
        data
    });
};

/**
 * 下载hooting
 * @param data
 * @returns
 */
export const downloadEC = (data: any) => {
    return request({
        url: '/scrm-api/console/sale/contract/download-ec',
        method: 'POST',
        data
    });
};

//路线配置
export const ksShopConfig = () => {
    return request({
        url: '/scrm-api/console/retail/shop/ks-shop-config',
        method: 'POST'
    });
};

//获取快手小店的授权URL
export const ksAuthUrl = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/ks-auth-url',
        method: 'GET',
        params: data
    });
};

//获取快手小店的授权结果
export const authResult = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/auth-result',
        method: 'GET',
        params: data
    });
};
// 获取视频号小店信息
export const getWxVshopInfo = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/wx-vshop-info',
        method: 'GET',
        params: data,
        noNeedLoading: true
    });
};

// 获取视频号小店信息无需登录的,附带过期时间的
export const getWxVshopInfoNotToken = (data: any) => {
    return request({
        url: '/scrm-api/guest/sphxd/wx-vshop-info',
        method: 'GET',
        params: data,
        noNeedLoading: true
    });
};

// 创建店铺
export const creatWxVshop = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/create',
        method: 'POST',
        data
    });
};
/**
 * @description: 用户行为列表 商品搜索
 * @param {any} data
 * @return {*}
 */
export const queryProductList = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/product/search/list',
        method: 'POST',
        data
    });
};

/**
 * @description: 用户行为列表 页面搜索
 * @param {any} data
 * @return {*}
 */
export const queryPageList = (data: any) => {
    return request({
        url: '/scrm-api/console/media/content/page/search/list',
        method: 'POST',
        data
    });
};

// 检验店铺ID
export const checkStore = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/check-shop',
        method: 'POST',
        data
    });
};

/**
 * @description: 点击启会员通获取渠道列表
 * @param {any} data
 * @return {*}
 */
export const getChannelByShopId = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/get-channel',
        method: 'POST',
        data
    });
};

/**
 * @description: 点击启会员通弹窗的确定获取渠道的积分设置
 * @param {any} data
 * @return {*}
 */
export const getPointsSettingByChannelId = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/get-points-setting',
        method: 'POST',
        data
    });
};

/**
 * @description: 启用会员通
 * @param {any} data
 * @return {*}
 */
export const openEnableHyt = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/enable_hyt',
        method: 'POST',
        data
    });
};

/**
 * @description: 店铺路线列表
 * @param {any} data
 * @return {*}
 */
export const shopLineList = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/shop-line-list',
        method: 'POST',
        data
    });
};

/**
 * @description: 授权码校验
 * @param {any} data
 * @return {*}
 */
export const verifyAuthCode = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/verify-auth-code',
        method: 'POST',
        data,
        noNeedLoading: true
    });
};

/**
 * @description: 虚拟号服务校验
 * @param {any} data
 * @return {*}
 */
export const verifyNumServe = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/verify-virtual-number-serve',
        method: 'POST',
        data,
        noNeedLoading: true
    });
};

/**
 * @description: 数据初始化
 * @param {any} data
 * @return {*}
 */
export const shopDateInit = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/shop-data-init',
        method: 'POST',
        data
    });
};

/**
 * @description: 校验
 * @param {any} data
 * @return {*}
 */
export const verifyShopSerNumber = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/is-promotion-config',
        method: 'POST',
        data,
        noNeedLoading: true
    });
};

/**
 * 店铺详情 推广活动-统计-数据总览
 * @param data
 * @returns
 */
export const getStaticsPromotion = (data: any) => {
    return request({
        url: '/scrm-api/console/retail/shop/statics-promotion',
        method: 'POST',
        data,
        timeout: 60000,
        noNeedLoading: true
    });
};
